//
//  JsBarButtonItemManager.m
//  DuTe
//
//  Created by Gikki Ares on 2020/12/9.
//  Copyright © 2020 vgemv. All rights reserved.
//

#import "JsBarButtonItemManager.h"
@implementation JsBarButtonItemManager

+ (UIBarButtonItem *) barButtonItemWithImage:(UIImage *)image width:(CGFloat)width target:(nullable id)target action:(nullable SEL)sel {
	CGRect bounds = CGRectMake(0, 0, width, width);
	UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, width, width)];
	imageView.image = image;
	UIButton * btn = [[UIButton alloc]initWithFrame:bounds];
	UIView * view = [[UIView alloc]initWithFrame:bounds];
	[view addSubview:imageView];
	[view addSubview:btn];
	[btn addTarget:target action:sel forControlEvents:UIControlEventTouchUpInside];
	UIBarButtonItem * uiBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:view];
	return uiBarButtonItem;
}




@end
